#include "Theme.h"
#include "include/core/SkData.h"
#include "include/core/SkTypeface.h"
#include "include/core/SkFontMgr.h"
#include "include/ports/SkFontMgr_empty.h"
#include "src/ports/SkFontMgr_win_dw.cpp"

namespace yzrilyzr_simplecanvas{
	sk_sp<SkTypeface> Theme::defaultTypeface=nullptr;
	static sk_sp<SkFontMgr> fontmgr_factory(){
		return SkFontMgr_New_DirectWrite();
	}
	void  Theme::loadTypeface(const std::string & path){
		sk_sp<SkData> fontData=SkData::MakeFromFileName(path.c_str());
		if(!fontData){
			std::cout << "Font Read Error" << std::endl;
			return;
		}
		sk_sp<SkFontMgr> fontMgr=fontmgr_factory();
		if(!fontMgr){
			std::cout << "FontMgr Error" << std::endl;
			return;
		}
		sk_sp<SkTypeface> paramRegPtr=fontMgr->makeFromData(fontData);
		if(!paramRegPtr){
			std::cout << "Typeface Error" << std::endl;
			return;
		}
		Theme::setDefaultTypeface(paramRegPtr);
	}
	void Theme::loadTheme(){
	}
}